package com.lb.mybatis.scan;

import org.mybatis.spring.annotation.MapperScans;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;

/**
 * 注意必须在springboot启动类上使用@Import(MapperScannerRegister.class)
 *
 * @author zhangjun
 * @since 2025/04/17
 */
public class MapperScannerRegister implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        AnnotationAttributes mapperScansAttrs = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(MapperScans.class.getName()));
        System.out.println("扫描mapperScans注解的包");
    }
}
